package com.weds.edjk.web;

import com.weds.core.annotation.Logs;
import com.weds.core.base.BaseController;
import com.weds.core.resp.JsonResult;
import com.weds.edjk.service.FileMonitorService;
import com.weds.edjk.vo.DepTreeVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author zcz
 * @Description 档案管理监控
 * @Date 2020-6-9
 */
@RestController
@RequestMapping(value = "/file/monitor")
@Api(value = "档案管理监控", description = "档案管理监控")
public class FileMonitorController extends BaseController {

    @Autowired
    FileMonitorService fileMonitorService;

    /**
     * 档案管理部门树
     * @return
     */
    @Logs
    @ApiOperation(value = "档案管理部门树", notes = "档案管理部门树")
    @RequestMapping(value = "/getDepTree", method = RequestMethod.GET)
    public JsonResult<Object> getDepTree() {
        List<DepTreeVo> depTree = fileMonitorService.getDepTree();
        return succMsgData(depTree);
    }

    /**
     * 档案管理头部信息
     * @param userDept
     * @return
     */
    @Logs
    @ApiOperation(value = "档案管理头部信息", notes = "档案管理头部信息")
    @RequestMapping(value = "/getHeadCount", method = RequestMethod.GET)
    public JsonResult<Object> getHeadCount(String userDept) {
        Map<String, Object> count = fileMonitorService.getHeadCount(userDept);
        return succMsgData(count);
    }

    /**
     * 学历柱形图
     * @param userDept
     * @return
     */
    @Logs
    @ApiOperation(value = "学历柱形图", notes = "学历柱形图")
    @RequestMapping(value = "/getXueLiStatis", method = RequestMethod.GET)
    public JsonResult<Object> getXueLiStatis(String userDept) {
        Map<String, Object> map = fileMonitorService.getXueLiStatis(userDept);
        return succMsgData(map);
    }

    /**
     * 工种柱形图
     * @param userDept
     * @return
     */
    @Logs
    @ApiOperation(value = "工种柱形图", notes = "工种柱形图")
    @RequestMapping(value = "/getWorkTypeStatis", method = RequestMethod.GET)
    public JsonResult<Object> getWorkTypeStatis(String userDept) {
        Map<String, Object> map = fileMonitorService.getWorkTypeStatis(userDept);
        return succMsgData(map);
    }

    /**
     * 工作年限柱形图
     * @param userDept
     * @return
     */
    @Logs
    @ApiOperation(value = "工作年限柱形图", notes = "工作年限柱形图")
    @RequestMapping(value = "/getWorkdayStatis", method = RequestMethod.GET)
    public JsonResult<Object> getWorkdayStatis(String userDept) {
        Map<String, Object> map = fileMonitorService.getWorkdayStatis(userDept);
        return succMsgData(map);
    }

    /**
     * 年龄柱形图
     * @param userDept
     * @return
     */
    @Logs
    @ApiOperation(value = "年龄柱形图", notes = "年龄柱形图")
    @RequestMapping(value = "/getAgeStatis", method = RequestMethod.GET)
    public JsonResult<Object> getAgeStatis(String userDept) {
        Map<String, Object> map = fileMonitorService.getAgeStatis(userDept);
        return succMsgData(map);
    }
}